﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Work
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable has = new Hashtable();
            has.Add(1, "十宗罪1");
            has.Add(2, "十宗罪2");
            has.Add(3, "十宗罪3");
            has.Add(4, "十宗罪4");
            has.Add(5, "十宗罪5");
            has.Add(6, "十宗罪6");
            Console.WriteLine("请输入图书编号");
            int id = int.Parse(Console.ReadLine());
            bool flag = has.ContainsKey(id);
            if (flag)
            {
                Console.WriteLine("您查找的图书名称为：{0}", has[id].ToString());
            }
            else
            {
                Console.WriteLine("您查找的图书编号不存在！");
            }
            Console.WriteLine("图书馆一共有{0}本书",+has.Count);
            Console.WriteLine("所有的图书信息如下：");
            foreach (DictionaryEntry item in has)
            {
                int key = (int)item.Key;
                string value = item.Value.ToString();
                Console.WriteLine("图书编号：{0}，图书名称：{1}", key, value);
            }
        }
    }
}
